package de.fh.ffm.elevator;

/**
 * 
 * This class is meant to improve testability of the elevator simulator
 * by allowing to use different elevator movement behavior for tests.
 * 
 */
public abstract class ArrivalStrategy {

	/**
	 * ElevatorManager that's using the ArrivalStrategy
	 */
	protected ElevatorManager elevatorManager;

	ArrivalStrategy ( ElevatorManager elevatorManager ) {
		this.elevatorManager = elevatorManager;
		this.elevatorManager.setArrivalStrategy(this);

	}

	/**
	 * abstract elevatorLeftFor method that's used to test or simulate the delay caused by moving from floor to floor
	 * 
	 * @param Elevator that's being moved; Start original floor; Dest destination floor;
	 */
	public abstract void elevatorLeftFor ( Elevator e, Floor start, Floor dest );

	/**
	 * lets the elevator instantly arrive at the next floor on ElevatorManagers destination list
	 * 
	 * @param Elevator
	 */
	public void letElevatorArrive ( Elevator e ) {
		Floor f = elevatorManager.getDestinationFloorForElevator(e);
		elevatorManager.elevatorArrivedAtFloor(e, f);
	}

}
